﻿import com.dmotiko.zonaoutlet.*
import com.dmotiko.general.*
import mx.utils.Delegate;

class ZOHome
extends ZOSiteSection {
	private var mcSelector:SelectorClip;
		
	function ZOHome() {
		super( ZOSite.getApp() );
		sName = ZOSite.HOME;
		sectionChanged();
	}
	
	public function childLoaded( e ):Void {
		switch( e.target ) {
			case mcSelector:
			var aData:Array = ZOSite.getApp().getOutletsData("0");
			mcSelector.setData( aData );
			mcSelector.setLabel("seleccionar outlet");
			mcSelector.addEventListener( BaseClipEvent.CHANGED, Delegate.create( this, selector_changed ) );
			break;
		}
	}
	
	private function selector_changed( evnt ):Void {
		ZOSite.getApp().setActiveOutlet( evnt.data.value );
		ZOSite.getApp().setSection( ZOSite.BUSCADOR );
	}
	
}